<?php
$host = "0.0.0.0";
$port = 9501;
$server = new swoole_server($host,$port);
$server->set([
    'worker_num'=>8,
    'max_request'=>10000
]);
$server->on('connect',function($server,$fd,$from_id){
    var_dump($server);
    var_dump($fd);
    var_dump($from_id);
    echo "连接上\n";
});
$server->on('receive',function($server,$fd,$from_id,$data){
    var_dump($from_id);
    echo "接收到了 {$data}\n";
});
$server->on('close',function($server,$fd){
    var_dump($server);
    var_dump($fd);
    echo "关闭\n";
});
$server->start();
